
'use strict';
const cloud = require('tcb-admin-node');
const tcbConfig = { env: 'meatom04dev-0g86uke14c3a060f' }; //当前环境 ENV_ID
const auth = cloud.init(tcbConfig).auth();
const db = cloud.database();
exports.main = async (event, context) => {
  // event
  let passInfo = {}
  passInfo.passId = event.pass_id
  passInfo.winOrlose = event.winOrLose
  passInfo.damage = event.damage
  passInfo.deathList = event.deathList
  passInfo.time = new Date()
  passInfo.uid = event.uid
  return db.collection('PassInfo').add({
    data: passInfo
  })
    .then(res => {
      return true
    })
    .catch(fail => {
      console.log(fail)
      return false
    })
}
